<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">个人基础信息</a></li>
    </ul>
    </div>
    <div class="formbody">
    <ul class="forminfo">
    <li><label>登录帐号</label><div class="label_right">${ admin_account }</div></li>
     <li><label>姓名</label><div class="label_right">${ userName }</div></li>
      <li><label>性别</label><div class="label_right">${ userSex }</div></li>
      <li><label>所属院系</label><div class="label_right">${ departmentName }</div></li>
    <li><label>系统角色	</label><div class="label_right">${ userRoleName }</div></li>
    <c:if test="${ userRole>1 }">
    <li><label>联系电话</label><input name="userPhone" type="text" id="userPhone" class="dfinput" value="${ userPhone }" onblur="pOnchange();"/></li>
	<li><label>&nbsp;</label><input name="" type="button" class="btn" onclick="saveBase();" value="确认保存"/></li>
	</c:if>
    </ul>
    </div>
</body>
<script src="js/jquery-1.7.2.js"></script>
<script src="layer/layer.js"></script>
<script type="text/javascript" src="js/jquery.tips.js"></script>
<script>
function pOnchange() {
	var inp = document.getElementById("userPhone");
	var reg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
	var result = reg.test(inp.value);
	if (!result) {
		$("#userPhone").tips({
			side : 1,
			msg : '手机号格式不对，请重新输入!',
			bg : '#0099FF',
			time : 3
		});
		return false;
	}
	};
function saveBase() {
	if($("#userPhone").val()==''){
		$("#userPhone").tips({
			side : 1,
			msg : '	请输入联系电话!',
			bg : '#0099FF',
			time : 3
		});
		return false;
	}
	var inp = document.getElementById("userPhone");
	var reg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
	var result = reg.test(inp.value);
	if (!result) {
		$("#userPhone").tips({
			side : 1,
			msg : '手机号格式不对，请重新输入!',
			bg : '#0099FF',
			time : 3
		});
		return false;
	}
	$.ajax({
		type: "POST",
		url: "admin/user_edit.do",
		data: { userPhone : $("input[name='userPhone']").val(),},
		async: true,
		dataType: "json",
		success: function(data) {
			if("success" == data.result){
				layer.alert('修改成功!', {
		            skin: 'layer-ext-moon' 
				}, function(){
					location.reload();
				 });
		}else {
			layer.alert('修改失败!', {
	            skin: 'layer-ext-moon' 
	        });
			}
			}
		})
}
</script>
</html>
